package com.veryGood.service.Impl;


import com.veryGood.common.result.R;
import com.veryGood.domain.pojo.EmployeeInfo;
import com.veryGood.mapper.EmployeeMapper;
import com.veryGood.service.EmployeeManageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class EmployeeManageServiceImpl implements EmployeeManageService {

    @Autowired
    EmployeeMapper emp;

    @Override
    public R addEmployee(EmployeeInfo empDto) {
        if (emp.addEmployee(empDto)>0) return R.success("添加success");
        return R.error("添加失败");
    }

    @Override
    public R delEmployee(Integer userId) {
        if (emp.delEmployee(userId)>0) return R.success("删除success");
        return R.error("删除失败");
    }

    @Override
    public List<EmployeeInfo> allEmployee() {
        List<EmployeeInfo> allemp=emp.allEmployee();
        if (allemp.size() !=0){
            return allemp;
        }
        return null;
    }
}
